package com.locatme.adapter;

import android.app.Activity;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.main.locatme.R;

import java.util.List;

public class PagesViewAdapter extends ArrayAdapter<String> {
    private final Activity activity;
    private final List<String> values;

    public PagesViewAdapter(Activity activity, List<String> values) {
        super(activity, R.layout.rowlayout, values);
        this.activity = activity;
        this.values = values;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        LayoutInflater inflater = (LayoutInflater) activity
                .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View rowView = inflater.inflate(R.layout.rowlayout, parent, false);
        TextView textView = (TextView) rowView.findViewById(R.id.label);
        ImageView imageView = (ImageView) rowView.findViewById(R.id.icon);
        textView.setText(values.get(position));
        // change the icon for Windows and iPhone
        String s = values.get(position);

        return rowView;
    }
}
